﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Elentok.Common;
using AMail.Common.Interfaces.Data;
using Elentok.Common.Async;

namespace AMail.Common.Interfaces.Services
{
  public interface IDataService
  {
    IMailArchive CreateArchive(string filename, string passphrase);
    IMailArchive OpenArchive(string filename, string passphrase);

    IMailFolder CreateFolder();
    IMailMessage CreateMessage(byte[] data);

    /// <summary>
    /// This will import all of the ".eml" files in the given folder
    /// and put all of them in a new folder under <paramref name="parentFolder"/>
    /// (the root of this folder in the mail archive folder tree will be 
    ///  the name of the folder path).
    /// <para>
    /// The mail folder of the path that was imported (not connected to a parent folder)
    /// </para>
    /// </summary>
    /// <returns>The mail folder of the path that was imported</returns>
    /// <param name="sourcePath"></param>
    /// <param name="recursive">True to scan subfolders</param>
    /// <param name="progressNotifier">A progress notifier to report the progress to</param>
    /// <param name="errors">A dictionary of the errors that occured during the import</param>
    IMailFolder ImportFolder(string sourcePath, bool recursive, IAsyncProgressNotifier progressNotifier, Dictionary<string, InvalidEmlException> errors);
  }
}
